
<!DOCTYPE html>
<html lang="en-US">
<head>
    <meta charset="UTF-8"/>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1" name="viewport" />
    <meta http-equiv="content-script-type" content="text/javascript">
    <meta name="format-detection" content="telephone=no" />
    <!-- uc强制竖屏 -->
    <meta name="screen-orientation" content="portrait">
    <!-- QQ强制竖屏 -->
    <meta name="x5-orientation" content="portrait">
            <link rel="shortcut icon" href="/favicon.ico">
            <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
        <meta http-equiv="Pragma" content="no-cache" />
        <meta http-equiv="Expires" content="0" />
    <title>修改资料</title>
    <link rel="stylesheet"href="statics/mobile/css/style.css?v=201708115933363455">
    <link rel="stylesheet"href="statics/mobile/css/SpsBtn.css?v=201708115933363455">
	<style type="text/css">
		.mlogin_name{margin:7px auto;}
	</style>
</head>

<body style="width:100%;">

<div class="membersbox pad50">
<section class="fall-back"><a href="/User/mycoupon/sid/4001109.html?pid=27020622">修改资料</a></section>
<section class="mlogin_user">
  <section class="mlogin_name g-box logo" style="height:100px; padding-top:10px;">
	<section class="mlogin_namele" style="  line-height: 30px;">头像：</section>
	<section class="mlogin_nameri g-flex" style="height: inherit;">
		<div class="upload">
			<span class="tip"></span>
			<img src="<?php echo $customer['headimgurl'];?>" width="100px" height="100px" alt="" class="j-showUploadfile" id="avatar_box" onclick="upload('avatar');">
		</div>
	</section>
</section>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele"><label style="color:red;">*</label>手机号码：</section>
      <section class="mlogin_nameri g-flex">
		  <?php if(!empty($customer['mobile'])){?>
          <?php echo $customer['mobile'];?>
		  <?php } else {?>
		  <input type="text" name="mobile" id="mobile" placeholder="手机号只能设置一次" value="<?php echo $customer['mobile'];?>">
		  <?php }?>
      </section>
  </section>
   <section class="mlogin_name g-box">
      <section class="mlogin_namele">Email：</section>
      <section class="mlogin_nameri g-flex">
          <input type="text" name="email" id="email" placeholder="电子邮箱，找回密码使用" value="<?php echo $customer['email'];?>">
      </section>
  </section>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele">昵称：</section>
      <section class="mlogin_nameri g-flex">
          <input type="text" id="username" placeholder="您的昵称，只做为显示" value="<?php echo $customer['username'];?>">
      </section>
  </section>
  <?php if(!empty($customer['passwd'])){?>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele"><label style="color:red;">*</label>原密码：</section>
      <section class="mlogin_nameri g-flex">
          <input type="text" id="old_password" placeholder="原密码">
      </section>
  </section>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele"><label style="color:red;">*</label>修改密码：</section>
      <section class="mlogin_nameri g-flex">
          <input type="text" id="new_password" placeholder="修改密码">
      </section>
  </section>
  <?php } else {?>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele"><label style="color:red;">*</label>密码：</section>
      <section class="mlogin_nameri g-flex">
          <input type="text" id="old_password" placeholder="密码">
      </section>
  </section>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele"><label style="color:red;">*</label>确认密码：</section>
      <section class="mlogin_nameri g-flex">
          <input type="text" id="new_password" placeholder="确认密码">
      </section>
  </section>
  <?php }?>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele">支付密码：</section>
      <section class="mlogin_nameri g-flex">
          <input type="text" id="set_pay_password" placeholder="支付密码只允许设置一次">
      </section>
  </section>
  <section class="mlogin_name g-box">
      <section class="mlogin_namele">性别：</section>
      <section class="mlogin_nameri g-flex">
          <select id="sex">
			<option value="0" selected>男</option>
			<option value="1">女</option>
		  </select>
      </section>
  </section>
 
  
  <section class="mlogin_but" style="margin-top:23px; height:94px; padding-bottom:20px;">
	<button type="button" id="submit" class="mbtn btn-warning mgt10">提交</button>
	<section class="clear"></section>
  </section>
</section>
<?php include VIEWS_PATH."bottom.php";?>
</div>
<?php include VIEWS_PATH."footer.php";?>
<div id="tempform" style="display:none;"></div>
<iframe id="tempframe" name="tempframe" style="display:none;"></iframe>
<script>
var id='<?php echo $customer["id"];?>';
var site_root='<?php echo API_ROOT;?>';
function upload(field){
	str='<form id="'+field+'form" target="tempframe" method="post" action="'+site_root+'tool/upload.php" enctype="multipart/form-data"><input id="'+field+'" name="'+field+'" style="display: none" type="file" value=""></form>';
	$("#tempform").html(str);
	$("#"+field).click();
}
$("#tempform").on("change","input[type='file']",function(){
	$(this).parent().submit();
});

function parseFile(file){
	$("#"+file.key+"_box").attr('src',file.name);
}
$("#submit").click(function(){
  var data={commit:1};
  data.avatar=$("#avatar_box").attr('src');
  data.mobile=$("#mobile").val();
  data.email=$("#email").val();
  data.username=$("#username").val();
  data.old_password=$("#old_password").val();
  data.new_password=$("#new_password").val();
  data.pay_password=$("#set_pay_password").val();
  data.sex=$("#sex").val();
  $.post('?con=user&act=profile',data,function(result){
    if(result.errcode=='1'){
      window.location.reload();
    } else {
		alert(result.errmsg);
	}
  },'json');
});
</script>

<!-- end -->
</body>
</html>
<!-- 20170105 -->
